<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Function</title>
</head>
<body>
	<h1>My Web Page</h1>
	<p id="myPar">I am a paragraph.</p>
	<div id="myDiv">I am a div.</div>

	<p><button type="button" onclick="myFunction()">点击这里</button></p>

	<p>当你点击上面的按钮时，两个元素会改变。</p>
	
	<script>
		function myFunction() {
			document.getElementById('myPar').innerHTML='Hello World';
			document.getElementById('myDiv').innerHTML='How are you?';			
		}
	</script>
</body>
</html>